import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ElectricityMeterVO, ElectricityMeterForm, ElectricityMeterQuery } from '@/api/house/electricityMeter/types';

/**
 * 查询电表信息列表
 * @param query
 * @returns {*}
 */

export const listElectricityMeter = (query?: ElectricityMeterQuery): AxiosPromise<ElectricityMeterVO[]> => {
  return request({
    url: '/house/electricityMeter/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询电表信息详细
 * @param id
 */
export const getElectricityMeter = (id: string | number): AxiosPromise<ElectricityMeterVO> => {
  return request({
    url: '/house/electricityMeter/' + id,
    method: 'get'
  });
};

/**
 * 新增电表信息
 * @param data
 */
export const addElectricityMeter = (data: ElectricityMeterForm) => {
  return request({
    url: '/house/electricityMeter',
    method: 'post',
    data: data
  });
};

/**
 * 修改电表信息
 * @param data
 */
export const updateElectricityMeter = (data: ElectricityMeterForm) => {
  return request({
    url: '/house/electricityMeter',
    method: 'put',
    data: data
  });
};

/**
 * 删除电表信息
 * @param id
 */
export const delElectricityMeter = (id: string | number | Array<string | number>) => {
  return request({
    url: '/house/electricityMeter/' + id,
    method: 'delete'
  });
};
